local hx__zhiheng = fk.CreateSkill {
  name = "hx__zhiheng",
}

hx__zhiheng:addEffect("active", {
  anim_type = "drawcard",
  min_card_num = 1,
  target_num = 0,
  prompt = "#hx__zhiheng",
  can_use = function(self, player)
    return player:usedSkillTimes(hx__zhiheng.name, Player.HistoryPhase) == 0
  end,
  card_filter = function(self, player, to_select, selected)
    return not player:prohibitDiscard(to_select)
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local hand = player:getCardIds(Player.Hand)
    local more = #hand > 0
    for _, id in ipairs(hand) do
      if not table.contains(effect.cards, id) then
        more = false
        break
      end
    end
    room:throwCard(effect.cards, hx__zhiheng.name, player, player)
    if not player.dead then
      room:drawCards(player, #effect.cards + (more and 1 or 0), hx__zhiheng.name)
    end
  end
})

return hx__zhiheng
